package cn.assumejson.springframework.core.util;

import cn.hutool.core.lang.Assert;

import java.lang.reflect.Method;

/**
 * @author gang.Li
 * @version 1.0
 * @since 1.0 2021/12/9 17:47
 */
@FunctionalInterface
public interface MethodFilter {

    /**
     * Determine whether the given method matches.
     *
     * @param method the method to check
     */
    boolean matches(Method method);

    default MethodFilter and(MethodFilter next) {
        Assert.notNull(next, "Next MethodFilter must not be null");
        return method -> matches(method) && next.matches(method);
    }
}
